export const drawer_config = () => {
    const config = {
        show: false,
        title: "新增数据",
        direction: "rtl",
        size: "30%",
        labelWidth: "90px",
        messageBox: {
            status: true,
            title: "提示",
            message: "是否保存当前数据？",
            confirmButtonText: '保存',
            cancelButtonText: '放弃',
            type: 'warning', // success
            confirmEventName: "save",
            cancelEventName: null
        },
        ifSave: true,
        form: [
            {
                key: "menuId",
                type: "hidden",
            },
            {
                key: "parentId",
                type: "treeSelect",
                label: "上级菜单",
                alert: "",
                options: [],
                props: {value: "menuId", label: "menuName"}
            },
            {
                key: "menuType",
                type: "radio",
                label: "目录类型",
                alert: "目录不能指定组件，菜单是可以指定路由和组件的，按钮是配置权限应用的",
                source: "dict", //source: dict字典查询/select 数据来源方向
                dict: "sys_menu_type"
            },
            {key: "menuName", type: "text", label: "菜单名称", alert: ""},
            {key: "orderNum", type: "number", label: "显示排序", min: 0, max: 999, alert: ""},
            {
                key: "isFrame",
                type: "radio",
                label: "是否为外链",
                alert: "外链需要以https开头",
                source: "select", //source: dict字典查询/select 数据来源方向
                select: [{value: "0", label: '是'}, {value: "1", label: '否'}],
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["M", "C"]
                }]
            },
            {
                key: "path", type: "text", label: "路由地址", alert: "子汇管理需配置为：/home/...", condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["M", "C"]
                }]
            },
            {
                key: "component",
                type: "text",
                label: "组件路径",
                alert: "访问的组件路径，子汇管理需配置为：/src/pages/home/...",
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["C"]
                }]
            },
            {
                key: "perms",
                type: "text",
                label: "权限字符",
                alert: "控制器中定义的权限字符，如：@PreAuthorize(`@ss.hasPermi('system:user:list')`)",
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["C","F"]
                }]
            },
            {
                key: "query",
                type: "text",
                label: "路由参数",
                alert: "访问路由的默认传递参数，如：`{\"id\": 1, \"name\": \"ry\"}`",
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["C"]
                }]
            },
            {
                key: "isCache",
                type: "radio",
                label: "是否缓存",
                alert: "选择是则会被`keep-alive`缓存，需要匹配组件的`name`和地址保持一致",
                source: "select", //source: dict字典查询/select 数据来源方向
                select: [{value: "1", label: '是'}, {value: "0", label: '否'}],
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["C"]
                }]
            },
            {
                key: "visible",
                type: "radio",
                label: "显示状态",
                alert: "选择隐藏则路由将不会出现在侧边栏，但仍然可以访问",
                source: "select", //source: dict字典查询/select 数据来源方向
                select: [{value: "0", label: '是'}, {value: "1", label: '否'}],
                condition: [{  // 在这些条件下则显示
                    type: "equal", //equal 等于则显示 noEqual 不等于则显示
                    key: "menuType",
                    value: ["M","C"]
                }]
            },
            {
                key: "status",
                type: "radio",
                label: "菜单状态",
                alert: "选择停用则路由将不会出现在侧边栏，也不能被访问",
                source: "select", //source: dict字典查询/select 数据来源方向
                select: [{value: "0", label: '是'}, {value: "1", label: '否'}]
            },

        ],
        //https://github.com/yiminghe/async-validator
        rules: {
            menuName: [
                {required: true, message: '请输入目录名称', trigger: 'blur'},
                {min: 2, max: 9, message: '长度需要2-9个汉字', trigger: 'blur'},
            ],
            orderNum: [
                {required: true, message: '请输入显示排序', trigger: 'blur'},
            ]
        }
    }
    return config
}